package sniff.pack;

import control.SystemUIControl;

public class MyIPv6Packet extends CommonIPPacket {
	protected String version;
	protected String trafficClass;
	protected String flowLabel;
	protected int payLoadLen;
	protected int hopLimit;
	
	
	public MyIPv6Packet() {

	}

	public MyIPv6Packet(String sourceMAC, String destinationMAC, String type, int lenght, String info, byte[] head,
			byte[] data,String version, String trafficClass, String flowLabel, int payLoadLen, String protocol,
			int hopLimit, String sourceIP, String destinationIP) {
		super(sourceMAC, destinationMAC, type, lenght, info, head, data,sourceIP,destinationIP,protocol);
		this.version = version;
		this.trafficClass = trafficClass;
		this.flowLabel = flowLabel;
		this.payLoadLen = payLoadLen;
		this.hopLimit = hopLimit;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public String getTrafficClass() {
		return trafficClass;
	}

	public void setTrafficClass(String trafficClass) {
		this.trafficClass = trafficClass;
	}

	public String getFlowLabel() {
		return flowLabel;
	}

	public void setFlowLabel(String flowLabel) {
		this.flowLabel = flowLabel;
	}

	public int getPayLoadLen() {
		return payLoadLen;
	}

	public void setPayLoadLen(int payLoadLen) {
		this.payLoadLen = payLoadLen;
	}

	public int getHopLimit() {
		return hopLimit;
	}

	public void setHopLimit(int hopLimit) {
		this.hopLimit = hopLimit;
	}

	
	@Override
	public String getInfo() {
		if(childPacket!=null) {
			return this.childPacket.getInfo();
		}
		return super.getInfo();
	}

	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append(super.toString());
		sb.append(SystemUIControl.SPLITSTRING+"\n");
		sb.append("Version:" + this.version + "\n");
		sb.append("Traffic Class:"+this.trafficClass+"\n");
		sb.append("Flow Label:"+this.flowLabel+"\n");
		sb.append("PayLoad Lenght:"+this.payLoadLen+"\n");
		sb.append("Protocol:"+this.protocol+"\n");
		sb.append("Hop Limit:"+this.hopLimit+"\n");
		sb.append("Source IP:"+this.sourceIP+"\n");
		sb.append("Destination IP:"+this.destinationIP+"\n");
		if(this.childPacket!=null) {
			sb.append(SystemUIControl.SPLITSTRING+"\n");
			sb.append(this.childPacket.toString());
		}
		return sb.toString();
	}
	
}
